import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/article',
    name: 'article',
    component: () => import(/* webpackChunkName: "about" */ '../views/ArticleView.vue')
  },
  {
    path: '/content',
    name: 'content',
    component: () => import(/* webpackChunkName: "about" */ '../views/ContentDisplayView.vue')
  },
  {
    path: '/introduce',
    name: 'introduce',
    component: () => import(/* webpackChunkName: "about" */ '../views/IntroduceView.vue')
  },
  {
    path: '/contact',
    name: 'contact',
    component: () => import(/* webpackChunkName: "about" */ '../views/ContactView.vue')
  },
  {
    path: '/create',
    name: 'create',
    component: () => import(/* webpackChunkName: "about" */ '../views/CreateView.vue')
  },
  {
    path: '/createdsuccess',
    name: 'createdsuccess',
    component: () => import(/* webpackChunkName: "about" */ '../views/CreatedSuccessfullyView.vue')
  },
  {
    path: '/403',
    name: 'error-403',
    component: () => import('../views/error/Error403Page.vue')
  },
  {
    path: '/404',
    name: 'error-404',
    component: () => import('../views/error/Error404Page.vue')
  },
  {
    path: '/500',
    name: 'error-500',
    component: () => import('../views/error/Error500Page.vue')
  },
  // 捕获所有未匹配的路由
  {
    path: '/:pathMatch(.*)*',
    redirect: '/404'
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
